<!DOCTYPE html>
<html>
<body>


<script>
function myFunction()
{
	var outMessage = document.getElementById("outBox").value;
	var publicDns = document.getElementById( "publicDns" ).value;
	
	var url = "http://" + publicDns + "Team_27";
	var mes = "{ \"chatroom\":\"1\", \"message\":\"" + outMessage + "\"}";
	document.getElementById( "inBox" ).value = mes;
	
	var client = new XMLHttpRequest();

	client.open("POST", url, false);
	client.setRequestHeader("Content-Type", "application/json");
	
	client.onreadystatechange = function () 
	{
		if (client.status == 200)
		console.log("The request succeeded!\n\nThe response representation was:\n\n" + client.responseText)
	else
		console.log("The request did not succeed!\n\nThe response status was: " + client.status + " " + client.statusText + ".");
	}
	client.send(mes);

	document.getElementById( "outBox" ).value = "";
}
</script>
Public DNS:
<br>
<input type='text' id='publicDns' value="ec2-54-198-202-46.compute-1.amazonaws.com:8080/"> 
<br><br>
Inbox:
<br>
<textarea name="content" rows="4" cols="50" id="inBox">
</textarea>
<br><br>
Outbox:
<br>
<input type='text' id='outBox' value='3'> 
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
</body>
</html>
